package com.yijinsuo.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.yijinsuo.R;
import com.yijinsuo.base.BaseFragment;
import com.yijinsuo.base.ViewPagerIndicatorAdapter;
import com.yijinsuo.mian.MainActivity;
import com.yijinsuo.view.TitleBar;
import com.yijinsuo.view.XViewPagerIndicator;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 投资
 */
public class FinancialFragment extends BaseFragment{

    @Bind(R.id.titlebar)
    TitleBar titlebar;
    @Bind(R.id.id_stickynavlayout_indicator)
    XViewPagerIndicator mViewPagerindicator;

    @Bind(R.id.id_stickynavlayout_viewpager)
    ViewPager mviewPager;
    //
    private MainActivity activity;
    private View view;

    //
    private String[] titles = { "消费贷", "车贷","新手"};
    private List<Fragment> fragments = new ArrayList<Fragment>();
    private ViewPagerIndicatorAdapter mviewPagerIndicatorAdapter;

    //
    private  BaoLiFragment mBaoLiFragment;
    private  CheDaiFragment mCheDaiFragment;
    private  NewHandFragment mnewHandFragment;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_financial, container, false);
        activity = (MainActivity) getActivity();
        super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, view);
        return view;
    }
    @Override
    protected void initTitle() {

        titlebar.setTitleBar(0,"我要投资",0);
    }

    @Override
    protected void initView() {
        mCheDaiFragment=new CheDaiFragment();
        mBaoLiFragment=new BaoLiFragment();
        mnewHandFragment=new NewHandFragment();
        //
        fragments.add(mBaoLiFragment);
        fragments.add(mCheDaiFragment);
        fragments.add(mnewHandFragment);
        mviewPagerIndicatorAdapter=new ViewPagerIndicatorAdapter(activity.getSupportFragmentManager(),fragments);
        mViewPagerindicator.setIndicatorColor(Color.BLUE);
        mviewPager.setAdapter(mviewPagerIndicatorAdapter);
        mViewPagerindicator.setTitles(titles, mviewPager);
        mViewPagerindicator.setIndicatorColor(Color.RED);

    }

    @Override
    protected void setData() {

    }

    @Override
    protected void widgetClick(View view) {

    }

}
